<div id="auth">
    <?php if($this->status == true){?>
    <?php if($this->image != null)
                $img = $this->image;
          else $img = 'avatar.jpg';
        ?>
    
    <div id="logged">
        <div class="role"><?php echo $this->role?></div>
        <div class="image">
            <a href="#"><img src="<?php echo $this->baseUrl('default/images/user/') .$img?>" alt="avatar"/></a>
        </div>
        <div class="user">
            <p>Chào bạn: <a href="#" class="username"><?php echo $this->name?></a></p>
            <p><a class="change-info" href="<?php echo $this->baseUrl('user/editinfo/id/') .$this->userid?>" title="Thay đổi thông tin">Sửa thông tin</a></p>
            <p><a href="<?php echo $this->baseUrl('authentication/logout')?>" class="logout">Thoát</a></p>
        </div>
    </div><!--end logged-->
    <?php }?>
    
    <?php if($this->status == false){?>
    <div id="login">
        <h3><?php echo $this->translate('Login')?></h3>
        <form action="<?php echo $this->baseUrl('authentication/login') ?>" method="post" enctype="multipart/form-data">
            <div class="input">
                
                <?php echo $this->form_login->username?>
            </div>
            <div class="input">
               
                <?php echo $this->form_login->password?>
            </div>
            <div class="remember">
                <?php echo $this->form_login->remember?> Ghi nhớ
            </div>
            <div class="submit">
                <?php echo $this->form_login->submitlogin?>
            </div>
            <div class="register">
                <p> <a href="<?php echo $this->baseUrl('dang-ky.html')?>">Đăng ký |</a>
                <a href="<?php echo $this->baseUrl("nguoi-dung/quen-mat-khau.html")?>" class="forget">Quên mật khẩu?</a></p>
            </div>
        </form>
    </div><!--end login-->
    <?php }?>
</div>


<script>
$(document).ready(function(){
    $("#login form").submit(function(){
        var link = $("#login form").attr("action");
//         alert(link);
//         alert($(this).serialize());      
        $.ajax({
            type: "post",
            url: link,
            data: $(this).serialize(),
            dataType: "html",
            success: function(data){
            	$("#auth").empty();                
                $("#auth").html(data);
                }
            });
        return false;
        });
	
});
</script>